<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <my-title></my-title>
    </div>

    <template id="title">
        <h2>{{title}}</h2>
    </template>

    <script src="../assets/vue3.js"></script>
    <script>
        // 自定义组件名
        const MyTitle = ('my-title', {
            data() {
                return {
                    title: 'this is vue component test'
                }
            },
            template: '#title',
        });
        // 根组件
        const App = {
            components: {
                MyTitle, // 局部组件
            },
        };
        Vue.createApp(App).mount('#app'); //创建并挂载
    </script>
</body>

</html>